package org.uni_hi.lsep.gui.test.sim;

import java.util.Vector;

import javax.swing.table.DefaultTableModel;

import org.uni_hi.lsep.util.DataPacket;

public class RuleTableModel extends DefaultTableModel {
		/**
		 * 
		 */
		private static final long serialVersionUID = 1L;

		public RuleTableModel(int rowCount, int columnCount) {
			super(rowCount, columnCount);
		}

		public boolean isCellEditable(int row,int column){
			return false;
		}

		public DataPacket getRemovedRuleRow(int row){
			DataPacket result=(DataPacket) dataVector.remove(row);
			fireTableDataChanged();
			return result;
		}
		
		@SuppressWarnings("unchecked")
		public void addRuleRow(DataPacket v){
			dataVector.add(0,v);
			fireTableDataChanged();
		}
		
		public void clearDataVector(){
			dataVector.removeAllElements();
			fireTableDataChanged();
		}
		
		@SuppressWarnings("unchecked")
		public Vector<DataPacket> getRuleVector(){
			return (Vector<DataPacket>) dataVector;
		}
}
